| return a |
| #functions.py |
| def addExclamation(a): |
| line = addExclamation("Hello") |
| #main.py |
| print(line) |
| a = a + "!" |
|   return a |
| #functions.py |
| def addExclamation(a): |
| line = addExclamation("Hello") |
| #main.py |
| print(line) |
|   a = a + "!" |
| 1 | #functions.py |
| 2 | def addExclamation(a): |
| 3 |   a = a + "!" |
| 4 |   return a |
| 5 | |
| 6 | #main.py |
| 7 | line = addExclamation("Hello") |
| 8 | print(line) |
| x = tenTimes(3) |
| def tenTimes(a): |
| return a |
| #functions.py |
| a = a * 10 |
| #main.py |
| print(x) |
| x = tenTimes(3) |
| def tenTimes(a): |
|   return a |
| #functions.py |
|   a = a * 10 |
| #main.py |
| print(x) |
| 1 | #functions.py |
| 2 | def tenTimes(a): |
| 3 |   a = a * 10 |
| 4 |   return a |
| 5 | |
| 6 | #main.py |
| 7 | x = tenTimes(3) |
| 8 | print(x) |
| y = addFive(10) |
| print(x+y) |
| x = addFive(3) |
| return a |
| a = a + 5 |
| def addFive(a): |
| #functions.py |
| #main.py |
| y = addFive(10) |
| print(x+y) |
| x = addFive(3) |
|   return a |
|   a = a + 5 |
| def addFive(a): |
| #functions.py |
| #main.py |
| 1 | #functions.py |
| 2 | def addFive(a): |
| 3 |   a = a + 5 |
| 4 |   return a |
| 5 | |
| 6 | #main.py |
| 7 | x = addFive(3) |
| 8 | y = addFive(10) |
| 9 | print(x+y) |
| x = isA("A") |
| return False |
| print(y) |
| if a == "A": |
| #main.py |
| def isA(a): |
| #functions.py |
| return True |
| else: |
| print(x) |
| y = isA("B") |
| x = isA("A") |
|     return False |
| print(y) |
|   if a == "A": |
| #main.py |
| def isA(a): |
| #functions.py |
|     return True |
|   else: |
| print(x) |
| y = isA("B") |
| 1 | #functions.py |
| 2 | def isA(a): |
| 3 |   if a == "A": |
| 4 |     return True |
| 5 |   else: |
| 6 |     return False |
| 7 | |
| 8 | #main.py |
| 9 | x = isA("A") |
| 10 | print(x) |
| 11 | y = isA("B") |
| 12 | print(y) |
| print(w) |
| #main.py |
| w = add(5,10) |
| c = a + b |
| def add(a,b): |
| #functions.py |
| return c |
| print(w) |
| #main.py |
| w = add(5,10) |
|   c = a + b |
| def add(a,b): |
| #functions.py |
|   return c |
| 1 | #functions.py |
| 2 | def add(a,b): |
| 3 |   c = a + b |
| 4 |   return c |
| 5 | |
| 6 | #main.py |
| 7 | w = add(5,10) |
| 8 | print(w) |
| w = area(20,10) |
| def area(a,b): |
| #main.py |
| #functions.py |
| print(w) |
| c = a * b |
| return c |
| w = area(20,10) |
| def area(a,b): |
| #main.py |
| #functions.py |
| print(w) |
|   c = a * b |
|   return c |
| 1 | #functions.py |
| 2 | def area(a,b): |
| 3 |   c = a * b |
| 4 |   return c |
| 5 | |
| 6 | #main.py |
| 7 | w = area(20,10) |
| 8 | print(w) |
| #main.py |
| w = perimeter(20,10) |
| def perimeter(a,b): |
| print(w) |
| c = a * 2 + b * 2 |
| #functions.py |
| return c |
| #main.py |
| w = perimeter(20,10) |
| def perimeter(a,b): |
| print(w) |
|   c = a * 2 + b * 2 |
| #functions.py |
|   return c |
| 1 | #functions.py |
| 2 | def perimeter(a,b): |
| 3 |   c = a * 2 + b * 2 |
| 4 |   return c |
| 5 | |
| 6 | #main.py |
| 7 | w = perimeter(20,10) |
| 8 | print(w) |
| a = a * 2 |
| r = multiTwo(8) |
| print(r) |
| return a |
| #main.py |
| def multiTwo(a): |
| #functions.py |
|   a = a * 2 |
| r = multiTwo(8) |
| print(r) |
|   return a |
| #main.py |
| def multiTwo(a): |
| #functions.py |
| 1 | #functions.py |
| 2 | def multiTwo(a): |
| 3 |   a = a * 2 |
| 4 |   return a |
| 5 | |
| 6 | #main.py |
| 7 | r = multiTwo(8) |
| 8 | print(r) |
| a = a * 2 |
| x = multiTwo(20) |
| #main.py |
| def multiTwo(a): |
| print(x + y) |
| #functions.py |
| y = multiTwo(10) |
| return a |
|   a = a * 2 |
| x = multiTwo(20) |
| #main.py |
| def multiTwo(a): |
| print(x + y) |
| #functions.py |
| y = multiTwo(10) |
|   return a |
| 1 | #functions.py |
| 2 | def multiTwo(a): |
| 3 |   a = a * 2 |
| 4 |   return a |
| 5 | |
| 6 | #main.py |
| 7 | x = multiTwo(20) |
| 8 | y = multiTwo(10) |
| 9 | print(x + y) |
| def combineStr(a,b): |
| c = a + " " + b |
| #main.py |
| #functions.py |
| return c |
| x = combineStr("hello","friend") |
| print(x) |
| def combineStr(a,b): |
|   c = a + " " + b |
| #main.py |
| #functions.py |
|   return c |
| x = combineStr("hello","friend") |
| print(x) |
| 1 | #functions.py |
| 2 | def combineStr(a,b): |
| 3 |   c = a + " " + b |
| 4 |   return c |
| 5 | |
| 6 | #main.py |
| 7 | x = combineStr("hello","friend") |
| 8 | print(x) |
| return False |
| print(r) |
| else: |
| return True |
| #main.py |
| l2 = a[1] |
| l1 = a[0] |
| def isSame(a,b): |
| if l1 == l2: |
| r = isSame("hello","hi") |
| #functions.py |
|     return False |
| print(r) |
|   else: |
|     return True |
| #main.py |
|   l2 = a[1] |
|   l1 = a[0] |
| def isSame(a,b): |
|   if l1 == l2: |
| r = isSame("hello","hi") |
| #functions.py |
| 1 | #functions.py |
| 2 | def isSame(a,b): |
| 3 |   l1 = a[0] |
| 4 |   l2 = a[1] |
| 5 |   if l1 == l2: |
| 6 |     return True |
| 7 |   else: |
| 8 |     return False |
| 9 | |
| 10 | #main.py |
| 11 | r = isSame("hello","hi") |
| 12 | print(r) |
| else: |
| #functions.py |
| else: |
| def isSame(a,b): |
| return False |
| print("They don't start with the same character") |
| #main.py |
| l2 = a[1] |
| i = input() |
| i2 = input() |
| if l1 == l2: |
| if z == True: |
| print("Enter two inputs") |
| z = isSame(i,i2) |
| print("They start with the same character") |
| return True |
| l1 = a[0] |
|   else: |
| #functions.py |
| else: |
| def isSame(a,b): |
|     return False |
|   print("They don't start with the same character") |
| #main.py |
|   l2 = a[1] |
| i = input() |
| i2 = input() |
|   if l1 == l2: |
| if z == True: |
| print("Enter two inputs") |
| z = isSame(i,i2) |
|   print("They start with the same character") |
|     return True |
|   l1 = a[0] |
| 1 | #functions.py |
| 2 | def isSame(a,b): |
| 3 |   l1 = a[0] |
| 4 |   l2 = a[1] |
| 5 |   if l1 == l2: |
| 6 |     return True |
| 7 |   else: |
| 8 |     return False |
| 9 | |
| 10 | #main.py |
| 11 | print("Enter two inputs") |
| 12 | i = input() |
| 13 | i2 = input() |
| 14 | z = isSame(i,i2) |
| 15 | if z == True: |
| 16 |   print("They start with the same character") |
| 17 | else: |
| 18 |   print("They don't start with the same character") |
| return empty |
| empty = empty + arr[x] + " " |
| empty = "" |
| #functions.py |
| def printArray(arr): |
| result = printArray(["this","is","a","test"]) |
| #main.py |
| empty = empty.strip() |
| print(result) |
| for x in range(len(arr)): |
|   return empty |
|     empty = empty + arr[x] + " " |
|   empty = "" |
| #functions.py |
| def printArray(arr): |
| result = printArray(["this","is","a","test"]) |
| #main.py |
|   empty = empty.strip() |
| print(result) |
|   for x in range(len(arr)): |
| 1 | #functions.py |
| 2 | def printArray(arr): |
| 3 |   empty = "" |
| 4 |   for x in range(len(arr)): |
| 5 |     empty = empty + arr[x] + " " |
| 6 |   empty = empty.strip() |
| 7 |   return empty |
| 8 | |
| 9 | #main.py |
| 10 | result = printArray(["this","is","a","test"]) |
| 11 | print(result) |
| return False |
| #Remember when a return happens the function ends, if it gets to the other if statements must be false |
| def isdate(a): |
| #main.py |
| if second > 12 or second < 1: |
| return True |
| if first > 31 or first < 1: |
| print(result) |
| first = a[0:2] |
| result = isdate("12/15/2021") |
| return False |
| #functions.py |
| first = int(first) |
| second = a[3:5] |
| second = int(second) |
|     return False |
|   #Remember when a return happens the function ends, if it gets to the other if statements must be false |
| def isdate(a): |
| #main.py |
|   if second > 12 or second < 1: |
|   return True |
|   if first > 31 or first < 1: |
| print(result) |
|   first = a[0:2] |
| result = isdate("12/15/2021") |
|     return False |
| #functions.py |
|   first = int(first) |
|   second = a[3:5] |
|   second = int(second) |
| 1 | #functions.py |
| 2 | def isdate(a): |
| 3 |   first = a[0:2] |
| 4 |   first = int(first) |
| 5 |   if first > 31 or first < 1: |
| 6 |     return False |
| 7 |    |
| 8 |   second = a[3:5] |
| 9 |   second = int(second) |
| 10 |   if second > 12 or second < 1: |
| 11 |     return False |
| 12 |   #Remember when a return happens the function ends, if it gets to the other if statements must be false |
| 13 |   return True |
| 14 |    |
| 15 | #main.py |
| 16 | result = isdate("12/15/2021") |
| 17 | print(result) |
| return False |
| second = int(second) |
| #functions.py |
| i = input() |
| else: |
| second = a[3:5] |
| while True: |
| return False |
| return True |
| first = a[0:2] |
| first = int(first) |
| print("Not valid, please try again") |
| break |
| #main.py |
| if valid == True: |
| if second > 12 or second < 1: |
| valid = isdate(i) |
| print("Enter a date in the format dd/mm/yyyy") |
| def isdate(a): |
| if first > 31 or first < 1: |
|     return False |
|   second = int(second) |
| #functions.py |
|   i = input() |
|   else: |
|   second = a[3:5] |
| while True: |
|     return False |
|   return True |
|   first = a[0:2] |
|   first = int(first) |
|     print("Not valid, please try again") |
|     break |
| #main.py |
|   if valid == True: |
|   if second > 12 or second < 1: |
|   valid = isdate(i) |
|   print("Enter a date in the format dd/mm/yyyy") |
| def isdate(a): |
|   if first > 31 or first < 1: |
| 1 | #functions.py |
| 2 | def isdate(a): |
| 3 |   first = a[0:2] |
| 4 |   first = int(first) |
| 5 |   if first > 31 or first < 1: |
| 6 |     return False |
| 7 |    |
| 8 |   second = a[3:5] |
| 9 |   second = int(second) |
| 10 |   if second > 12 or second < 1: |
| 11 |     return False |
| 12 |   return True |
| 13 |    |
| 14 | #main.py |
| 15 | while True: |
| 16 |   print("Enter a date in the format dd/mm/yyyy") |
| 17 |   i = input() |
| 18 |   valid = isdate(i) |
| 19 |   if valid == True: |
| 20 |     break |
| 21 |   else: |
| 22 |     print("Not valid, please try again") |
| arr = [] |
| for x in range(length): |
| length = b - a |
| print(numArray(5,8)) |
| #main.py |
| arr.append(a + x) |
| #functions.py |
| def numArray(a,b): |
| return arr |
|   arr = [] |
|   for x in range(length): |
|   length = b - a |
| print(numArray(5,8)) |
| #main.py |
|     arr.append(a + x) |
| #functions.py |
| def numArray(a,b): |
|   return arr |
| 1 | #functions.py |
| 2 | def numArray(a,b): |
| 3 |   length = b - a |
| 4 |   arr = [] |
| 5 |   for x in range(length): |
| 6 |     arr.append(a + x) |
| 7 |   return arr |
| 8 | |
| 9 | #main.py |
| 10 | print(numArray(5,8)) |
| print(x) |
| for x in numArray(1,21): |
| #main.py |
|   print(x) |
| for x in numArray(1,21): |
| #main.py |
| 1 | #main.py |
| 2 | for x in numArray(1,21): |
| 3 |   print(x) |
| 4 |    |
| if arr[x] > m: |
| #functions.py |
| maxNum = maxArr([5,4,2,1]) |
| #main.py |
| print(maxNum) |
| m = arr[0] |
| m = arr[x] |
| def maxArr(arr): |
| for x in range(1,len(arr)): |
| return m |
|     if arr[x] > m: |
| #functions.py |
| maxNum = maxArr([5,4,2,1]) |
| #main.py |
| print(maxNum) |
|   m = arr[0] |
|       m = arr[x] |
| def maxArr(arr): |
|   for x in range(1,len(arr)): |
|   return m |
| 1 | #functions.py |
| 2 | def maxArr(arr): |
| 3 |   m = arr[0] |
| 4 |   for x in range(1,len(arr)): |
| 5 |     if arr[x] > m: |
| 6 |       m = arr[x] |
| 7 |   return m |
| 8 | |
| 9 | #main.py |
| 10 | maxNum = maxArr([5,4,2,1]) |
| 11 | print(maxNum) |
| def getIndex(arr,a): |
| #functions.py |
| return x |
| for x in range(len(arr)): |
| #main.py |
| i = getIndex([5,4,2,1],1) |
| if arr[x] == a: |
| return -1 #invalid |
| print(i) |
| def getIndex(arr,a): |
| #functions.py |
|       return x |
|   for x in range(len(arr)): |
| #main.py |
| i = getIndex([5,4,2,1],1) |
|     if arr[x] == a: |
|   return -1 #invalid |
| print(i) |
| 1 | #functions.py |
| 2 | def getIndex(arr,a): |
| 3 |   for x in range(len(arr)): |
| 4 |     if arr[x] == a: |
| 5 |       return x |
| 6 |   return -1 #invalid |
| 7 | |
| 8 | #main.py |
| 9 | i = getIndex([5,4,2,1],1) |
| 10 | print(i) |
| print(maxIndex([5,2,1,8,2])) |
| num = maxArr(arr) |
| idx = getIndex(arr,num) |
| #functions.py |
| return idx |
| #main.py |
| def maxIndex(arr): |
| print(maxIndex([5,2,1,8,2])) |
|   num = maxArr(arr) |
|   idx = getIndex(arr,num) |
| #functions.py |
|   return idx |
| #main.py |
| def maxIndex(arr): |
| 1 | #functions.py |
| 2 | def maxIndex(arr): |
| 3 |   num = maxArr(arr) |
| 4 |   idx = getIndex(arr,num) |
| 5 |   return idx |
| 6 | |
| 7 | #main.py |
| 8 | print(maxIndex([5,2,1,8,2])) |
| if s[x] != " ": |
| for x in range(len(s)): |
| empty = empty + s[x] |
| def spaceBad(s): |
| sb = spaceBad("this is a test string") |
| #functions.py |
| #main.py |
| return empty |
| empty = "" |
| print(sb) |
|     if s[x] != " ": |
|   for x in range(len(s)): |
|       empty = empty + s[x] |
| def spaceBad(s): |
| sb = spaceBad("this is a test string") |
| #functions.py |
| #main.py |
|   return empty |
|   empty = "" |
| print(sb) |
| 1 | #functions.py |
| 2 | def spaceBad(s): |
| 3 |   empty = "" |
| 4 |   for x in range(len(s)): |
| 5 |     if s[x] != " ": |
| 6 |       empty = empty + s[x] |
| 7 |   return empty |
| 8 | |
| 9 | #main.py |
| 10 | sb = spaceBad("this is a test string") |
| 11 | print(sb) |
| def addSpaces(s,a): |
| print(space + "|") |
| space = addSpaces("cs",10) |
| #functions.py |
| s = s + " " |
| #main.py |
| return s |
| print(space + "|") |
| space = addSpaces("test",10) |
| for x in range(a - len(s)): |
| def addSpaces(s,a): |
| print(space + "|") |
| space = addSpaces("cs",10) |
| #functions.py |
|     s = s + " " |
| #main.py |
|   return s |
| print(space + "|") |
| space = addSpaces("test",10) |
|   for x in range(a - len(s)): |
| 1 | #functions.py |
| 2 | def addSpaces(s,a): |
| 3 |   for x in range(a - len(s)): |
| 4 |     s = s + " " |
| 5 |   return s |
| 6 | |
| 7 | #main.py |
| 8 | space = addSpaces("test",10) |
| 9 | print(space + "|") |
| 10 | space = addSpaces("cs",10) |
| 11 | print(space + "|") |
| def capitalise(s): |
| #main.py |
| empty = s[0].upper() |
| return empty |
| print(title) |
| for x in range(1,len(s)): |
| title = capitalise("this is a test") |
| empty = empty + s[x] |
| else: |
| if empty[x - 1] == " ": |
| #functions.py |
| empty = empty + s[x].upper() |
| def capitalise(s): |
| #main.py |
|   empty = s[0].upper() |
|   return empty |
| print(title) |
|   for x in range(1,len(s)): |
| title = capitalise("this is a test") |
|       empty = empty + s[x] |
|     else: |
|     if empty[x - 1] == " ": |
| #functions.py |
|       empty = empty + s[x].upper() |
| 1 | #functions.py |
| 2 | def capitalise(s): |
| 3 |   empty = s[0].upper() |
| 4 |   for x in range(1,len(s)): |
| 5 |     if empty[x - 1] == " ": |
| 6 |       empty = empty + s[x].upper() |
| 7 |     else: |
| 8 |       empty = empty + s[x] |
| 9 |   return empty |
| 10 | |
| 11 | #main.py |
| 12 | title = capitalise("this is a test") |
| 13 | print(title) |
| #functions.py |
| print(logicOr(True,False)) |
| def logicNot(a): |
| if a == True or b == True: |
| return False |
| return False |
| return True |
| else: |
| return True |
| else: |
| #main.py |
| return False |
| return True |
| else: |
| if a == True: |
| print(logicNot(False)) |
| def logicAnd(a,b): |
| print(logicAnd(True,True)) |
| def logicOr(a,b): |
| if a == True and b == True: |
| #functions.py |
| print(logicOr(True,False)) |
| def logicNot(a): |
|   if a == True or b == True: |
|     return False |
|     return False |
|     return True |
|   else: |
|     return True |
|   else: |
| #main.py |
|     return False |
|     return True |
|   else: |
|   if a == True: |
| print(logicNot(False)) |
| def logicAnd(a,b): |
| print(logicAnd(True,True)) |
| def logicOr(a,b): |
|   if a == True and b == True: |
| 1 | #functions.py |
| 2 | def logicAnd(a,b): |
| 3 |   if a == True and b == True: |
| 4 |     return True |
| 5 |   else: |
| 6 |     return False |
| 7 | |
| 8 | def logicOr(a,b): |
| 9 |   if a == True or b == True: |
| 10 |     return True |
| 11 |   else: |
| 12 |     return False |
| 13 | |
| 14 | def logicNot(a): |
| 15 |   if a == True: |
| 16 |     return False |
| 17 |   else: |
| 18 |     return True |
| 19 | |
| 20 | #main.py |
| 21 | print(logicAnd(True,True)) |
| 22 | print(logicOr(True,False)) |
| 23 | print(logicNot(False)) |
| print(result) |
| result = logicOr(logicAnd(A,B),logicNot(C)) |
| B = False |
| C = False |
| #main.py |
| A = True |
| 1 | #main.py |
| 2 | A = True |
| 3 | B = False |
| 4 | C = False |
| 5 | result = logicOr(logicAnd(A,B),logicNot(C)) |
| 6 | print(result) |
| D = True |
| A = True |
| print(result) |
| #main.py |
| B = False |
| C = False |
| result = logicOr(logicNot(logicAnd(A,B)),logicOr(logicNot(C),D)) |
| 1 | #main.py |
| 2 | A = True |
| 3 | B = False |
| 4 | C = False |
| 5 | D = True |
| 6 | result = logicOr(logicNot(logicAnd(A,B)),logicOr(logicNot(C),D)) |
| 7 | print(result) |